# -*- coding: utf-8 -*-
"""
@author: wyb
@date: 2023/12/5
@time: 20:22
@desc:  imap.qq.com 993
password = "ndtmsyijvvtdbgdh"
"""

import imapclient
import pprint
from datetime import datetime

imapqq = 'outlook.office365.com'
port = 993
obj = imapclient.IMAPClient(imapqq, port)
# pwd = input()
user = 'wdhwyb@hotmail.com'
print(obj.login(user, 'kdmicdbrsbquwpql'))

# pprint.pprint(obj.list_folders())
obj.select_folder('INBOX', readonly=True)
search_criteria = [
        'SINCE', datetime(2023, 11, 1),
        'FROM', '49402612@qq.com'
    ]
uids = obj.search(search_criteria)
print(uids)

msg = obj.fetch(['41145', '41143'], ['BODY[]'])
pprint.pprint(msg)
